package org.dendy.browser.menubar;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;

/**
 * Class MenuBar dengan MenuItem About dari browser
 * 
 * @author dendy
 * 
 */

public class MenuBarHelp extends MenuBarBrowser {

	public MenuBarHelp(Shell shell) {
		this.shell = shell;
	}

	@Override
	public Menu createMenuItem() {
		bar = shell.getMenuBar();
		Menu menu = new Menu(bar);

		// Help->About
		item = new MenuItem(menu, SWT.PUSH);
		item.setText("About");
		item.setAccelerator(SWT.MOD1 + 'H');
		item.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent arg0) {
				MessageBox box = new MessageBox(shell, SWT.OK);
				box.setMessage("Browser Dendy\n" + "GPL\n"
						+ "Jakarta 29-06-2011");
				int result = box.open();
				if (result == SWT.OK) {
					shell.open();
				}
			}
		});

		return menu;
	}

}
